#include <iostream>

using namespace std;

int main()
{
    string A;
    string B;
    int R1;
    int R2;
    int R3;
    int R4;

    cout<<"Ingrese la primera palabra:"<<" ";
    cin>>A;

    cout<<"    "<<endl;

    cout<<"Ingrese la segunda palabra:"<<" ";
    cin>>B;

    R1=A.length();
    R2=B.length();
    R3=(R1-1);
    R4=(R2-1);

    if(A[R3]==B[R4])
    {

        cout<<"Los ultimos caracteres son iguales"<<" ";
    }
    else
    {
        cout<<"Los ultimos caracteres son diferentes"<<" ";
    }
    return 1;
}
